<script setup lang="ts">
import { onMounted, ref } from 'vue';
import HelloWorld from './components/HelloWorld.vue'
import Float from 'float-dom'

const num = ref(0)
onMounted(() => {

  let rangeNode = document.getElementById('rangeNode') as HTMLElement;
  let floatNode = document.getElementById('floatNode') as HTMLElement;
  
  new Float(
    rangeNode,
    floatNode,
    {
      margin: 10,
      position: 'br'
    },
    () => {
      console.log('点击')
      num.value++
    }
  )
})
</script>

<template>
  <div>
    <a href="https://vitejs.dev" target="_blank">
      <img src="/vite.svg" class="logo" alt="Vite logo" />
    </a>
    <a href="https://vuejs.org/" target="_blank">
      <img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
    </a>
  </div>
  <div id="floatNode" style="width:50px;height:50px;border:5px solid red;border-radius: 50%;cursor: pointer;user-select:none;">可拖拽 可点击</div>
  <div class="range" id="rangeNode">
    <h1 style="color: red">click float node: {{ num }}</h1>
    <HelloWorld msg="Vite + Vue"/>
  </div>
</template>

<style scoped>
.range {
  width: 500px;
  height: 500px;
  border: 1px solid blue;
}
.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
}
.logo:hover {
  filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}
</style>